home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <libraries/dos.h>
- #include <libraries/dosextens.h>
- #include <libraries/filehandler.h>
- #include <clib/exec_protos.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <pragmas/dos_pragmas.h>
- #include <pragmas/exec_pragmas.h>
-
- extern struct DosLibrary *DOSBase;
- STRPTR BstrOut(BSTR *bstr);
- void BstrC(BSTR *bstr,UBYTE *buf);
- int FindAssign(char *name);
- void Creds(void);
- void BstrC(BSTR *bstr,UBYTE *buf)
- {
- UBYTE *str;
- LONG loop,counter;
-
- counter=0;
- str = (UBYTE*) BADDR(bstr);
- for(loop=(LONG)str[0]; loop--; ++counter)
- {
- buf[counter] = str[counter+1];
- }
- buf[counter]='\0';
- }
-
- STRPTR BstrOut(BSTR *bstr)
- {
- UBYTE buf[256];
- BstrC(bstr,buf);
- return((char *)buf);
- }
-
- int FindAssign(char *name)
- {
- struct RootNode *rootnode;
- struct DosInfo *dosinfo;
- struct DeviceList *devicelist;
- char temp[256];
- register int i;
- i=0;
- strcpy(temp,name);
- while(temp[i])
- {
- if(temp[i]==':') { temp[i]='\0'; i=-1; break; }
- i++;
- }
- if(i!=-1) return(20);
- rootnode = (struct RootNode*) DOSBase->dl_Root;
- dosinfo = (struct DosInfo*) BADDR(rootnode->rn_Info);
- devicelist = (struct DeviceList*) BADDR(dosinfo->di_DevInfo);
- Forbid();
- while(devicelist->dl_Next)
- {
- if(!stricmp((STRPTR)BstrOut(devicelist->dl_Name),temp)/* && devicelist->dl_Type!=DLT_DEVICE*/) { Permit(); return(0); }
- devicelist = (struct DeviceList*) BADDR(devicelist->dl_Next);
- }
- Permit();
- return(20);
- }
-
-